str1 = '分开时难过不能说'
str2 = "谁没谁不能好好过"
str3 = """还不如让你选择想要的生活"""
print(str1)
print(str2)
print(str3)



# 字符串的格式化   符号%
name = "配合"
result = "该%s配合你演出的我，演视而不见"%(name)
print(result)



# format()
name1 = "其实"
result1 = "{}我也看出你有点不舍，感情也习惯我们来回拉扯，还计较着什么！".format(name1)
print(result1)



# f-strings
name2 = "其实"
result2 = f'{name2}台下的观众，就我一个！'
print(result2)



# 字符串拼接
one = "简单点,"
tow = "说话的方式简单点"
result3 = one + tow
print(result3)



# 字符串替换
word = "12345，上山打老虎。老虎有几只。"
result4 = word.replace("。","!")
print(result4)
result5 = word.replace("。","!",1)
print(result5)



# 字符串分割
word1 = "1 2 3 4 5"
result6 = word1.split()
print(result6)
word2 = "a,b,c,d,e"
result7 = word2.split(",")
print(result7)
result8 = word2.split(",",3)
print(result8)



#去除字符串两侧空格
word3 = "   对不起，我错了   "
result9 = word3.strip()
print(result9)




# 索引
str4 = "huangnan"
print([3])
print([-6])
#切片
result6 = str4[0:4]
print(result6)
result7 = str4[0:4:2]
print(result7)






